-----------------------------------------------------------
Migrating legacy SourceCodes to Campaign Management v1.3
-----------------------------------------------------------

This zip file contains several files that are relevant to migrating a client from using the legacy iMIS FR Campaign/Appeal model to using the new Campaign Management model for tracking Source Codes and Campaigns. The files contained herein are:

-----------
readme.txt 
-----------
   This readme file

----------------------------------------
0 - Query to populate the spreadsheet.sql
----------------------------------------
 A query used to generate the data that identifies all unique combinations of Campaign/Appeal used in Trans records across the client DB. This includes counts of the number of uses by year for the current year and 5 previous years. This additional data is intended to be used for review with the client to help them understand how they have been using Source Codes in the past so that they can consider how the new model will affect them.

Run this query to populate SourceCodesReview.v1.3.xlsx.

Run prior to the import.

----------------------------
SourceCodesReview.v1.3.xlsx
----------------------------
 A spreadsheet that is to be used to determine whether and which Source Codes will need to be updated in order to maintain uniqueness across all Campaign Management Source Codes. This spreadsheet involves a few copy/paste steps and one export to a tab delimited file step that are documented in the first tab of the file (Instructions). It ultimately yields the data to be used as the Source Code Importer file and some SQL to be inserted into the 4-Source Code Update Script.v1.2.sql file.

Note that in addition to calculating some new Source Codes, the logic in the spreadsheet will also assign any instances of SourceCodes used with no Campaign to a new Default Campaign.

--------------------------------
1 - Pre source code importer.sql
--------------------------------
Prepares the database for import, and must be run before the import. Do not proceed to step 3 until this script has been executed successfully.

There are steps in this script about how to perform step 2. 

----------------------------------------
3 - Post source code importer script.sql
----------------------------------------
Synchronizes legacy data with the new Campaign Management structure after the import. Ensures imported Source Codes and Campaigns are fully populated and consistent with historical data.

Run after the import.

-------------------------------------
4-Source Code Update Script.v1.3.sql
-------------------------------------
 The script that will update data in the client DB after the Source Codes have been Imported into the Campaign Management tables. This script will need to be populated with the results on the Source Code Update tab from the spreadsheet and then delivered to ASI to run after completing the Source Code Import.

Run after the import.

------------	
--Versions
v1.3 - revised the script file to include a post import script that was missing (26 August 2024 - KH)
------------
v1.2 - revised the steps (including some SQL) to support making this a well documented process for a client/Partner to perform before handing files back to ASI Upgrade contact for final migration (27 July 2021 - JHS)
------------
v1.1 - revised and simplified version (12 July 2021 - JHS)
------------
v1.0 - initial version of the generic use files (6 July 2021 - JHS)
------------
